<template>
    <div>
        <p>{{ sum }}</p><br>
        <p>{{ c }}</p>
        <span>姓名：</span>
        <input type="text" v-model="full"><br>
    </div>
</template>

<script setup lang="ts">
import { computed, ref } from 'vue'
const a = 10;
const b = 20;
const c = a + b;
// const sum = computed(() => a + b)
const sum = computed(() => { 
    return a+b
})
const firstName = ref("张三")
const lastName = ref("李四")
const full = computed({
    get() { 
        return firstName.value +''+lastName.value
    },
    set(value) { 
        // console.log(value);
        [firstName.value, lastName.value] = value.split('')
    }

})

</script>

<style scoped>

</style>